import {Align, SelectMode} from "../../common/ark-table/ArkTableOptions";
import {ElMessage} from "element-plus";
import ArkCompositeTable from "../ark-composite-table/ArkCompositeTable.vue";
import {ArkCompositeTableOptions} from "../ark-composite-table/ArkCompositeTableOptions";
import {TreeData} from "../../common/ark-side-tree/ArkSideTreeOptions";
import ArkTipType from "../../common-type/ark-tip-type";
import ArkInteractionType from "../../common-type/ark-interaction-type";
import dayjs from "dayjs";

export default {
  title: 'ark-component-v2/ArkCompositeTable',
  component: ArkCompositeTable,
  parameters: {
    docs: {
      description: {
        component: `请配合 <span style="font-weight: bold;font-size: 14px;color: grey">ArkSideTree、ArkActionBar、ArkFilterForm、ArkPaginationTable</span> 使用`
      }
    }
  },
  argTypes: {
    options: {description: 'ArkCompositeTableOptions'},
    default: {description: '表单内容部分'},
    '\'formItem-\' + item.prop': {description: '表单项内容部分，参数为model、formItem'},
    '\'formItemLabel-\' + item.prop': {description: '表单项名称部分，参数为model、formItem'},
    '\'formItemInteraction-\' + item.prop': {description: '表单项组件部分，参数为model、formItem'},
    '\'column-\' + column.prop': {description: '单元格内容部分，参数为row、column、rowIndex、value'},
  }
};

const menuTreeData = [
  {
    "id": 1,
    "text": "机构管理",
    "state": "closed",
    "children": [
      {
        "id": 2,
        "text": "区域设置",
        "state": null,
        "children": null
      },
      {
        "id": 3,
        "text": "类别设置",
        "state": null,
        "children": null
      },
      {
        "id": 4,
        "text": "机构设置",
        "state": null,
        "children": null
      },
      {
        "id": 5,
        "text": "用户设置",
        "state": null,
        "children": null
      },
      {
        "id": 103,
        "text": "等级设置",
        "state": null,
        "children": null
      },
      {
        "id": 1120634039701632,
        "text": "机构看板",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 6,
    "text": "学员管理",
    "state": "closed",
    "children": [
      {
        "id": 7,
        "text": "学员维护",
        "state": null,
        "children": null
      },
      {
        "id": 8,
        "text": "密码重置",
        "state": null,
        "children": null
      },
      {
        "id": 9,
        "text": "学员导入",
        "state": null,
        "children": null
      },
      {
        "id": 80,
        "text": "学员照片导入",
        "state": null,
        "children": null
      },
      {
        "id": 1120633724665984,
        "text": "学员信息审核",
        "state": null,
        "children": null
      },
      {
        "id": 1126033047146624,
        "text": "注册学员审核",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 10,
    "text": "信息设置",
    "state": "closed",
    "children": [
      {
        "id": 11,
        "text": "学分大类",
        "state": null,
        "children": null
      },
      {
        "id": 12,
        "text": "项目类型",
        "state": null,
        "children": null
      },
      {
        "id": 13,
        "text": "项目级别",
        "state": null,
        "children": null
      },
      {
        "id": 14,
        "text": "项目形式",
        "state": null,
        "children": null
      },
      {
        "id": 15,
        "text": "项目方式",
        "state": null,
        "children": null
      },
      {
        "id": 16,
        "text": "学分标准",
        "state": null,
        "children": null
      },
      {
        "id": 17,
        "text": "达标标准",
        "state": null,
        "children": null
      },
      {
        "id": 73,
        "text": "项目考核方式设置",
        "state": null,
        "children": null
      },
      {
        "id": 79,
        "text": "业务计算开关设置",
        "state": null,
        "children": null
      },
      {
        "id": 106,
        "text": "西医重要信息设置",
        "state": null,
        "children": null
      },
      {
        "id": 107,
        "text": "注销原因设置",
        "state": null,
        "children": null
      },
      {
        "id": 124,
        "text": "中医重要信息设置",
        "state": null,
        "children": null
      },
      {
        "id": 128,
        "text": "区自管Ⅱ类标准",
        "state": null,
        "children": null
      },
      {
        "id": 137,
        "text": "远程学分分数上限",
        "state": null,
        "children": null
      },
      {
        "id": 1128879298076800,
        "text": "达标总分标准",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 18,
    "text": "项目管理",
    "state": "closed",
    "children": [
      {
        "id": 19,
        "text": "项目维护",
        "state": null,
        "children": null
      },
      {
        "id": 20,
        "text": "I类导入",
        "state": null,
        "children": null
      },
      {
        "id": 21,
        "text": "II类导入",
        "state": null,
        "children": null
      },
      {
        "id": 23,
        "text": "其他导入",
        "state": null,
        "children": null
      },
      {
        "id": 95,
        "text": "II类、其他类学分项目维护",
        "state": null,
        "children": null
      },
      {
        "id": 125,
        "text": "II类项目审核",
        "state": null,
        "children": null
      },
      {
        "id": 138,
        "text": "非项目类项目导入",
        "state": null,
        "children": null
      },
      {
        "id": 1120634296000640,
        "text": "非项目类项目维护",
        "state": null,
        "children": null
      },
      {
        "id": 1120634526589056,
        "text": "区自管项目维护",
        "state": null,
        "children": null
      },
      {
        "id": 1120634987806848,
        "text": "非项目类项目审核",
        "state": null,
        "children": null
      },
      {
        "id": 1120635758420096,
        "text": "项目类项目导入",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 24,
    "text": "学分管理",
    "state": "closed",
    "children": [
      {
        "id": 25,
        "text": "学员学分输入",
        "state": null,
        "children": null
      },
      {
        "id": 26,
        "text": "学分导入",
        "state": null,
        "children": null
      },
      {
        "id": 72,
        "text": "年终学分审核",
        "state": null,
        "children": null
      },
      {
        "id": 74,
        "text": "学分维护\r\n",
        "state": null,
        "children": null
      },
      {
        "id": 77,
        "text": "个人学分导入",
        "state": null,
        "children": null
      },
      {
        "id": 78,
        "text": "达标导入",
        "state": null,
        "children": null
      },
      {
        "id": 108,
        "text": "学分批量导入(学员)",
        "state": null,
        "children": null
      },
      {
        "id": 115,
        "text": "学分审核",
        "state": null,
        "children": null
      },
      {
        "id": 1120633167282304,
        "text": "综合统计",
        "state": null,
        "children": null
      },
      {
        "id": 1120633259122816,
        "text": "综合看板",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 27,
    "text": "基本信息管理",
    "state": "closed",
    "children": [
      {
        "id": 28,
        "text": "学科",
        "state": null,
        "children": null
      },
      {
        "id": 29,
        "text": "职业类别",
        "state": null,
        "children": null
      },
      {
        "id": 30,
        "text": "职称",
        "state": null,
        "children": null
      },
      {
        "id": 31,
        "text": "学历",
        "state": null,
        "children": null
      },
      {
        "id": 32,
        "text": "学位",
        "state": null,
        "children": null
      },
      {
        "id": 33,
        "text": "专业",
        "state": null,
        "children": null
      },
      {
        "id": 116,
        "text": "执业资格",
        "state": null,
        "children": null
      },
      {
        "id": 117,
        "text": "职称段",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 34,
    "text": "下载专区",
    "state": "closed",
    "children": [
      {
        "id": 35,
        "text": "上传",
        "state": null,
        "children": null
      },
      {
        "id": 36,
        "text": "下载",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 37,
    "text": "统计查询",
    "state": "closed",
    "children": [
      {
        "id": 38,
        "text": "组织机构",
        "state": null,
        "children": null
      },
      {
        "id": 39,
        "text": "学员信息",
        "state": null,
        "children": null
      },
      {
        "id": 40,
        "text": "项目信息",
        "state": null,
        "children": null
      },
      {
        "id": 41,
        "text": "学分明细",
        "state": null,
        "children": null
      },
      {
        "id": 42,
        "text": "达标结果",
        "state": null,
        "children": null
      },
      {
        "id": 43,
        "text": "合格证",
        "state": null,
        "children": null
      },
      {
        "id": 44,
        "text": "单位达标",
        "state": null,
        "children": null
      },
      {
        "id": 45,
        "text": "学科达标",
        "state": null,
        "children": null
      },
      {
        "id": 47,
        "text": "类别达标",
        "state": null,
        "children": null
      },
      {
        "id": 49,
        "text": "学历达标",
        "state": null,
        "children": null
      },
      {
        "id": 82,
        "text": "职称达标",
        "state": null,
        "children": null
      },
      {
        "id": 104,
        "text": "等级达标",
        "state": null,
        "children": null
      },
      {
        "id": 105,
        "text": "拟达标率",
        "state": null,
        "children": null
      },
      {
        "id": 130,
        "text": "自查自评表",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 50,
    "text": "信息浏览",
    "state": "closed",
    "children": [
      {
        "id": 54,
        "text": "项目类型浏览",
        "state": null,
        "children": null
      },
      {
        "id": 55,
        "text": "学分授予标准",
        "state": null,
        "children": null
      },
      {
        "id": 58,
        "text": "达标标准浏览",
        "state": null,
        "children": null
      },
      {
        "id": 59,
        "text": "省市区域浏览",
        "state": null,
        "children": null
      },
      {
        "id": 60,
        "text": "机构类别浏览",
        "state": null,
        "children": null
      },
      {
        "id": 96,
        "text": "业务开关浏览",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 62,
    "text": "达标管理",
    "state": "closed",
    "children": [
      {
        "id": 63,
        "text": "达标审核",
        "state": null,
        "children": null
      },
      {
        "id": 64,
        "text": "达标结果查询",
        "state": null,
        "children": null
      },
      {
        "id": 81,
        "text": "达标记录导入",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 65,
    "text": "验证管理",
    "state": "closed",
    "children": [
      {
        "id": 66,
        "text": "合格证审核",
        "state": null,
        "children": null
      },
      {
        "id": 67,
        "text": "合格证代码输入",
        "state": null,
        "children": null
      },
      {
        "id": 68,
        "text": "合格证打印",
        "state": null,
        "children": null
      },
      {
        "id": 109,
        "text": "年中资格审核",
        "state": null,
        "children": null
      },
      {
        "id": 110,
        "text": "年中学分审核",
        "state": null,
        "children": null
      },
      {
        "id": 111,
        "text": "合格结果查询",
        "state": null,
        "children": null
      },
      {
        "id": 1120633520881792,
        "text": "合格证样式管理",
        "state": null,
        "children": null
      },
      {
        "id": 1120633586315392,
        "text": "合格证预览",
        "state": null,
        "children": null
      },
      {
        "id": 1126305269338240,
        "text": "合格证配置",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 69,
    "text": "系统管理",
    "state": "closed",
    "children": [
      {
        "id": 70,
        "text": "角色管理",
        "state": null,
        "children": null
      },
      {
        "id": 71,
        "text": "授权管理",
        "state": null,
        "children": null
      },
      {
        "id": 1120637437657216,
        "text": "用户管理",
        "state": null,
        "children": null
      },
      {
        "id": 1120637569384576,
        "text": "菜单管理",
        "state": null,
        "children": null
      },
      {
        "id": 1120637655253120,
        "text": "项目审核流程配置",
        "state": null,
        "children": null
      },
      {
        "id": 1120637723996288,
        "text": "学分审核流程配置",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 97,
    "text": "西医时间设置",
    "state": "closed",
    "children": [
      {
        "id": 98,
        "text": "系统纪年",
        "state": null,
        "children": null
      },
      {
        "id": 99,
        "text": "学员维护",
        "state": null,
        "children": null
      },
      {
        "id": 100,
        "text": "学分录入",
        "state": null,
        "children": null
      },
      {
        "id": 101,
        "text": "年度验证",
        "state": null,
        "children": null
      },
      {
        "id": 102,
        "text": "合格验证",
        "state": null,
        "children": null
      },
      {
        "id": 126,
        "text": "学分审核",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 118,
    "text": "中医时间设置",
    "state": "closed",
    "children": [
      {
        "id": 119,
        "text": "系统纪年",
        "state": null,
        "children": null
      },
      {
        "id": 120,
        "text": "学员维护",
        "state": null,
        "children": null
      },
      {
        "id": 121,
        "text": "学分录入",
        "state": null,
        "children": null
      },
      {
        "id": 122,
        "text": "年度验证",
        "state": null,
        "children": null
      },
      {
        "id": 123,
        "text": "合格验证",
        "state": null,
        "children": null
      },
      {
        "id": 127,
        "text": "学分审核",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 129,
    "text": "注销学员统计",
    "state": "closed",
    "children": [
      {
        "id": 131,
        "text": "单位查询",
        "state": null,
        "children": null
      },
      {
        "id": 132,
        "text": "学科查询",
        "state": null,
        "children": null
      },
      {
        "id": 133,
        "text": "类别查询",
        "state": null,
        "children": null
      },
      {
        "id": 134,
        "text": "学历查询",
        "state": null,
        "children": null
      },
      {
        "id": 135,
        "text": "职称查询",
        "state": null,
        "children": null
      },
      {
        "id": 136,
        "text": "等级查询",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 140,
    "text": "安全审计",
    "state": "closed",
    "children": [
      {
        "id": 141,
        "text": "用户日志",
        "state": null,
        "children": null
      },
      {
        "id": 142,
        "text": "操作日志",
        "state": null,
        "children": null
      },
      {
        "id": 1120638685945984,
        "text": "学分日志",
        "state": null,
        "children": null
      },
      {
        "id": 1120638759805056,
        "text": "学员日志",
        "state": null,
        "children": null
      }
    ]
  },
  {
    "id": 150,
    "text": "门户管理",
    "state": "closed",
    "children": [
      {
        "id": 151,
        "text": "栏目管理",
        "state": null,
        "children": null
      },
      {
        "id": 152,
        "text": "文章管理",
        "state": null,
        "children": null
      },
    ]
  },
]
const roleTreeData = [
  {
    "id": 1,
    "text": "系统管理员",
  },
  {
    "id": 10,
    "text": "上海市中医继续医学教育委员会",
  },
  {
    "id": 2,
    "text": "上海市继续医学教育委员会",
  },
  {
    "id": 3,
    "text": "市局",
  },
  {
    "id": 4,
    "text": "区局",
  },
  {
    "id": 5,
    "text": "市级医疗卫生机构",
  },
  {
    "id": 6,
    "text": "市中心城区医疗卫生机构",
  },
  {
    "id": 7,
    "text": "郊区县医疗卫生机构",
  },
  {
    "id": 8,
    "text": "科室",
  },
  {
    "id": 9,
    "text": "学员",
  },
  {
    "id": 11,
    "text": "审计",
  },
  {
    "id": 1128835997606016,
    "text": "运营",
  }
]
const pageData = [
  {
    "id": 1,
    "year": 2021,
    "scoreClassName": "Ⅰ类学分",
    "vocationalQualificationName": "西医",
    "titleSegmentName": "中级及以上",
    "maxScore": 5,
  },
  {
    "id": 2,
    "year": 2021,
    "scoreClassName": "Ⅱ类学分",
    "vocationalQualificationName": "西医",
    "titleSegmentName": "中级及以上",
    "maxScore": 5,
  },
  {
    "id": 4,
    "year": 2022,
    "scoreClassName": "Ⅰ类学分",
    "vocationalQualificationName": "西医",
    "titleSegmentName": "中级及以上",
    "maxScore": 30,
  },
  {
    "id": 5,
    "year": 2022,
    "scoreClassName": "Ⅱ类学分",
    "vocationalQualificationName": "西医",
    "titleSegmentName": "中级及以上",
    "maxScore": 30,
  },
  {
    "id": 6,
    "year": 2023,
    "scoreClassName": "Ⅰ类学分",
    "vocationalQualificationName": "西医",
    "titleSegmentName": "中级及以上",
    "maxScore": 5,
  },
  {
    "id": 7,
    "year": 2023,
    "scoreClassName": "Ⅱ类学分",
    "vocationalQualificationName": "西医",
    "titleSegmentName": "中级及以上",
    "maxScore": 5,
  }
];
const morePageData = [
  ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData,
  ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData,
  ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData,
  ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData,
  ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData,
  ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData,
  ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData,
  ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData,
  ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData, ...pageData,

]

export const Basic = {
  name: '基本使用',
  render: (args: ArkCompositeTableOptions) => ({
    components: {ArkCompositeTable},
    setup() {
      return {args};
    },
    template: `
      <ArkCompositeTable v-model:options="args.options" style="width: 900px;height: 400px"/>`,
  }),
  args: {
    options: {
      sideTreeOptions: {
        searchText: '哈哈哈',
        selectOptions: [
          {
            text: "菜单",
            value: "menu",
            defineTreeDataFetch(searchText: string) {
              ElMessage({
                message: '抓取树数据操作1，参数请看控制台打印',
                type: 'success',
              });
              console.log(searchText)

              return Promise.resolve(menuTreeData)
            },
            onNodeSelectChange(nodes: TreeData[]) {
              ElMessage({
                message: '树选中节点改变事件1，参数请看控制台打印',
                type: 'success',
              });
              console.log(nodes)
            },
            onNodeExpand(node: TreeData) {
              ElMessage({
                message: '树节点展开事件1，参数请看控制台打印',
                type: 'success',
              });
              console.log(node)
            },
          },
          {
            text: "角色",
            value: "role2",
          },
        ],
        defineTreeDataFetch(select: string, searchText: string) {
          ElMessage({
            message: '抓取树数据操作2，参数请看控制台打印',
            type: 'success',
          });
          console.log(select, searchText)

          return Promise.resolve(roleTreeData)
        },
        onNodeSelectChange(nodes: TreeData[]) {
          ElMessage({
            message: '树选中节点改变事件2，参数请看控制台打印',
            type: 'success',
          });
          console.log(nodes)
        },
        afterNodeSelectChange(nodes: TreeData[]) {
          ElMessage({
            message: '树选中节点改变之后2，参数请看控制台打印',
            type: 'success',
          });
          console.log(nodes)
        },
        onNodeExpand(node: TreeData) {
          ElMessage({
            message: '树节点展开事件2，参数请看控制台打印',
            type: 'success',
          });
          console.log(node)
        },
      },
      actionBarOptions: {
        actions: [
          {
            text: '刷新',
            icon: "icon-shuaxin",
            iconClass: "text-green",
          },
          {
            text: '添加',
            icon: "icon-tianjia",
            iconClass: "text-green",
          },
          {
            text: '删除',
            icon: "icon-shanchu",
            iconClass: "text-red",
          },
          {
            text: '修改',
            icon: "icon-xiugai13",
            iconClass: "text-blue",
          },
          {
            text: '查看',
            icon: "icon-chakanxuefenmingxi",
            iconClass: "text-blue",
          },
        ]
      },
      filterFormOptions: {
        formItems: [
          {
            label: '姓名',
            prop: 'name',
            tip: {
              title: '提示标题',
              content: '提示内容',
              type: ArkTipType.WARNING,
            },
          },
          {
            label: '性别',
            prop: 'sex',
            interaction: {
              type: ArkInteractionType.SELECT,
              options: [
                {text: '男', value: 'nan'},
                {text: '女', value: 'nv'},
              ],
            }
          },
          {
            label: '角色',
            prop: 'role',
            value: '',
            interaction: {
              type: ArkInteractionType.SELECT,
              options: () => {
                return Promise.resolve([
                  {text: '管理员', value: 'admin'},
                  {text: '医生', value: 'docter'},
                  {text: '老师', value: 'teacher'},
                  {text: '学生', value: 'student'},
                ])
              },
              extraAllOptionForAsync: true
            }
          },
          {
            label: '年龄',
            prop: 'age',
            value: 10,
            interaction: {
              type: ArkInteractionType.NUMBER,
              min: 0,
              max: 100,
              step: 10
            }
          },
          {
            label: '日期',
            prop: 'date',
            value: dayjs().format('YYYY-MM-DD'),
            interaction: {
              type: ArkInteractionType.DATE,
              valueFormat: 'YYYY-MM-DD',
              showFormat: 'YYYY~MM~DD',
            }
          },
        ],
        actions: {
          show: true,
          confirm: {
            show: true,
            beforeClick: () => {
              ElMessage({
                message: '按钮点击之前的操作，无参数',
                type: 'success',
              });
            },
            onClick: (params) => {
              ElMessage({
                message: '按钮点击操作，参数请看控制台打印',
                type: 'success',
              });
              console.log(params)
            },
            afterClick: (clickReturn: void | Promise<any>) => {
              ElMessage({
                message: '按钮点击之后的操作，参数请看控制台打印',
                type: 'success',
              });
              console.log(clickReturn)
            },
          },
          clear: {
            show: true,
            beforeClick: () => {
              ElMessage({
                message: '按钮点击之前的操作，无参数',
                type: 'success',
              });
            },
            onClick: () => {
              ElMessage({
                message: '按钮点击操作，无参数',
                type: 'success',
              });
            },
            afterClick: (clickReturn: void | Promise<any>) => {
              ElMessage({
                message: '按钮点击之后的操作，参数请看控制台打印',
                type: 'success',
              });
              console.log(clickReturn)
            },
          }
        },
      },
      tableOptions: {
        rowNumber: true,
        rowNumberPageStart: false,
        selectMode: SelectMode.MULTIPLE_CHECKBOX_ROWS,
        striped: true,
        columns: [
          {
            show: true,
            label: '年度',
            prop: 'year',
            width: '80px',
            align: Align.CENTER
          },
          {
            label: '学分分类',
            prop: 'scoreClassName',
          },
          {
            label: '执业资格',
            prop: 'vocationalQualificationName',
          },
          {
            label: '职称段',
            prop: 'titleSegmentName',
          },
          {
            label: '分数上限',
            prop: 'maxScore',
          },
        ],
        // data: pageData,
        pagination: {
          total: 6,
          pageSize: 2,
          pageNumber: 2,
          onPageSizeChange(pageSize: number) {
            ElMessage({
              message: '每页数量改变事件，参数请看控制台打印',
              type: 'success',
            });
            console.log('每页数量改变事件参数', pageSize);
          },
          afterPageSizeChange(pageSize: number) {
            ElMessage({
              message: '每页数量改变之后，参数请看控制台打印',
              type: 'success',
            });
            console.log('每页数量改变之后参数', pageSize);
          },
          onPageNumberChange(pageNumber: number) {
            ElMessage({
              message: '页码改变事件，参数请看控制台打印',
              type: 'success',
            });
            console.log('页码改变事件参数', pageNumber);
          },
          afterPageNumberChange(pageNumber: number) {
            ElMessage({
              message: '页码改变之后，参数请看控制台打印',
              type: 'success',
            });
            console.log('页码改变之后参数', pageNumber);
          },
        },
        fetchDataParams: {
          id: 1
        },
        defineDataFetch(params: any) {
          ElMessage({
            message: '请求操作，参数请看控制台打印',
            type: 'success',
          });
          console.log('请求操作参数', params);

          function getPageData(params: any) {
            if (params.pageSize >= pageData.length) {
              return pageData;
            }

            let startIndex = (params.pageNumber - 1) * params.pageSize;
            let endIndex = startIndex + params.pageSize;
            if (endIndex >= pageData.length) {
              return pageData.slice(startIndex, pageData.length);
            }

            return pageData.slice(startIndex, endIndex);
          }

          function getMorePageData(params: any) {
            if (params.pageSize >= morePageData.length) {
              return morePageData;
            }

            let startIndex = (params.pageNumber - 1) * params.pageSize;
            let endIndex = startIndex + params.pageSize;
            if (endIndex >= morePageData.length) {
              return morePageData.slice(startIndex, morePageData.length);
            }

            return morePageData.slice(startIndex, endIndex);
          }

          // return getPageData(params)

          /*return {
            total: pageData.length,
            pageSize: params.pageSoze,
            // rows: pageData,
            rows: getPageData(params),
          }*/

          return {
            total: morePageData.length,
            pageSize: params.pageSoze,
            // rows: pageData,
            rows: getMorePageData(params),
          }

          /*return Promise.resolve({
            total: pageData.length,
            pageSize: params.pageSoze,
            rows: getPageData(params)
          })*/
        }
      }
    }
  },
};